<template>
  <div class="blog">
    <input type="text" v-model="search" placeholder="关键词搜索" />
    <ul>
      <li class="blog-item" v-for="(item, index) in filteredBlogs" :key="index">
        <a target="_blank" :href="item.address">
          <div>{{ item.name }}</div>
        </a>
      </li>
      <li  class="blog-item">
        <router-link to="/edit"><div class="edit fl">|markdown生成器|</div></router-link>
        <a class='fr' href="http://wangloulaowang.gitee.io/blog" target="_blank">
          <div class="more">查看更多 ></div>
        </a>
      </li>
    </ul>
    
  </div>
</template>

<script>
import blogs from "@/assets/data/blogs.js";

export default {
  name: "blog",
  data() {
    return {
      blogs: blogs.data,
      search: "",
    };
  },
  mounted() {},
  computed: {
    filteredBlogs: function () {
      return this.blogs.filter((item) => {
        return item.name.match(this.search);
      });
    },
  },
  methods: {},
};
</script>

<style scoped>
.blog {
  padding: 10px;
  height: 100%;
}
.blog input {
  width: 80%;
  height: 30px;
  display: block;
  margin: 10px auto;
  font-size: 18px;
  border-radius: 5px;
  padding-left: 10px;
}
.blog ul {
  height: 100%;
}
.blog li {
  width: 90%;
  border: 1px solid #c1c1c1;
  border-radius: 5px;
  padding: 10px;
  margin: 5px auto;
  background: #fff;
  height: 20px;
}
.blog li a {
  color: #555;
}
.blog li a:hover {
  color: #999900;
}

.bottom {
  margin: 0px auto;
  width: 90%;
  height: 100px;
  padding: 10px 3px;
  box-sizing: border-box;
  font-size: 16px;
  line-height: 10px;
  color: #978686;
}

.bottom .readme {
  float: left;
  border-right: 2px solid #42b983;
  padding-right: 5px;
  margin-right: 5px;
  color: #555555;
}
.bottom .edit {
  float: left;
  color: #555555;
}
.bottom .more {
  float: right;
  color: #555555;
}
</style>
